﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SXT.ZJICT3.Web.Admin.Project.Shared.Basic
{
    public partial class Warning : System.Web.UI.Page
    {
        /// <summary>
        /// 错误页面ID
        /// </summary>
        public string PageID
        {
            get
            {
                return Request.QueryString["PageID"] ?? "";
            }
        }

        /// <summary>
        /// DialogID
        /// </summary>
        public string DialogID
        {
            get
            {
                return Request.QueryString["DialogID"] ?? "";
            }
        }

        /// <summary>
        /// Page_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                this.lblWarnningCode.Text = "警告时间："+DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            }
            //注册Loading脚本
            this.RegisterLoadingScript();
        }

        /// <summary>
        /// 注册Loading脚本
        /// </summary>
        protected virtual void RegisterLoadingScript()
        {
            string strSrcipt = @"
                $(function () {              
                    if (window.parent.$('#" + this.PageID + @"_loading').length > 0) {
                        window.parent.$('#" + this.PageID + @"_loading').fadeOut('normal');
                    }

                    if (window.parent.$('#" + this.DialogID + @" > #" + this.DialogID + @"_loading').length > 0) {
                        window.parent.$('#" + this.DialogID + @" > #" + this.DialogID + @"_loading').fadeOut('normal');
                    }
                });
            ";
            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "page_loading", strSrcipt, true);
        }
    }
}